package cn.ac.cintcm.dataconverge.researcher.service.impl;

import java.util.List;

import com.hs.core.page.PageParam;
import com.hs.core.page.PageUtil;
import com.hs.core.service.BaseSevice;

import cn.ac.cintcm.dataconverge.dao.IBaseDao;
import cn.ac.cintcm.dataconverge.researcher.dao.ICommentDao;
import cn.ac.cintcm.dataconverge.researcher.domain.Comment;
import cn.ac.cintcm.dataconverge.researcher.service.ICommentService;

public class CommentService extends BaseSevice implements ICommentService{

	private ICommentDao commentDao;
	
	public ICommentDao getCommentDao() {
		return commentDao;
	}

	public void setCommentDao(ICommentDao commentDao) {
		this.commentDao = commentDao;
	}

	public List listComments() {
		return commentDao.listComments();
	}

	public void addComment(Comment comment) {
		commentDao.save(comment);
	}

	public Comment getCommentById(Long id) {
		return commentDao.getCommentById(id);
	}

	public void delComment(Long id) {
		Comment comment=commentDao.getCommentById(id);
		if(comment!=null){
			delComment(comment);
		}
	}

	public void delComment(Comment comment) {
		commentDao.delete(comment);
	}

	@Override
	public IBaseDao getBaseDao() {
		// TODO Auto-generated method stub
		return commentDao;
	}

	public PageUtil getListCommentsPage(PageParam pageParam) {
		// TODO Auto-generated method stub
		return this.commentDao.getListCommentsPage(pageParam);
	}

}
